#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org

START=99
start() {
	mqttip=$(uci get mqttshell.src.ip)
	mqttport=$(uci get mqttshell.src.port)

        mac=$(uci get network.lan.macaddr | tr [a-f] [A-F] | tr -d :)
	subprefix='datacollect/shell/req/'${mac}
	pubprefix='datacollect/shell/rep/'${mac}

	mqttshell "$mqttip" "$mqttport" "$subprefix" "$pubprefix" > /dev/null 2>&1 &

}
stop() {
	pid=$(ps | grep mqttshell | grep -v init.d | grep -v grep | awk '{ print $1 }')
	kill -9 $pid
}

